#!/usr/bin/env node
const log = console.log

const me ={
    name:'zhaijialei',
    age:20,
    QQ:'2690795879'
};

const meArray = [
    {name:'zhaijialei',age:20},
    {name:'zita',age:21}
];

log('name:%s',me.name);//string
log('age:%d',me.age);//digital
log('num:%i',45);//integer
log('PI:%f',Math.PI);//float
log('user:%j',me);//输出对象json
log('user:%o',me);//输出对象object

//四种方式输出字符串
log('name:%s',me.name);//string
log('name:',me.name);
log('name:'+me.name);
log(`name:${me.name}`);

//用 console 的 dir 方法输出对象和对象的数组
console.dir(me);
console.dir(meArray);
//用 console 的 table 方法输出对象和对象的数组，观察 index 列的区别
console.table(me);
console.table(meArray);
console.table(me.name);

//用 console 的 dir 方法输出层次较深的对象
const deepObject = {
    level1: {
      level2: {
        level3: {
          key: "value"
        }
      }
    }
  };
console.dir(deepObject);

//向标准错误流中输出信息：Error：something wrong!
console.error("Error:something wrong!");
console.log("Error:someting wrong")

